<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Vue3</title>
</head>

<body>
    <div id="app">
        <p>商品名称：{{name}}</p>
        <p>商品价格：{{price}}</p>
        <p>商品名称和价格：{{nameprice}}</p>
    </div>

    <script src="https://unpkg.com/vue@next"></script>
    <script>
     Vue.createApp({
         data(){
           return{
                name:'洗衣机',
                price:'6800元'  
           }
         },
         computed:{
            nameprice:{
                get:function(){
                    return this.name+"**"+this.price;
                },
                set:function(newName){
                    var names=newName.split(' ');
                    this.name=names[0];
                    this.price=names[1];
                }
            }
         }
       }).mount('#app')
    </script>
</body>

</html>
